import request from './request'

// 线索相关API
const clueApi = {
  // 1. 线索列表查询
  getClueList: (params) => {
    return request({
      url: '/clues',
      method: 'GET',
      params
    })
  },

  // 2. 添加线索
  addClue: (data) => {
    return request({
      url: '/clues',
      method: 'POST',
      data
    })
  },

  // 3. 分配线索
  assignClue: (clueId, userId) => {
    return request({
      url: `/clues/assign/${clueId}/${userId}`,
      method: 'PUT'
    })
  },

  // 4. 伪线索处理
  markAsFakeClue: (id, data) => {
    return request({
      url: `/clues/false/${id}`,
      method: 'PUT',
      data
    })
  },

  // 5. 转商机处理
  transferToBusiness: (id) => {
    return request({
      url: `/clues/toBusiness/${id}`,
      method: 'PUT'
    })
  },

  // 6. 根据ID查询线索详情
  getClueById: (id) => {
    return request({
      url: `/clues/${id}`,
      method: 'GET'
    })
  },

  // 7. 跟进线索
  followClue: (data) => {
    return request({
      url: '/clues',
      method: 'PUT',
      data
    })
  },

  // 8. 线索池列表查询
  getCluePool: (params) => {
    return request({
      url: '/clues/pool',
      method: 'GET',
      params
    })
  }
}

export default clueApi